﻿using System;
using System.Net.Http;
using System.ServiceModel;
using System.ServiceModel.Web;
using Earthwatchers.Models;
using Earthwatchers.Services.Security;

namespace Earthwatchers.Services.Resources
{
    [ServiceContract]
    public class AuthenticatorResource
    {
        [WebGet(UriTemplate = "")]
        [BasicHttpAuthorization(Role.Earthwatcher)]
        public bool Authenticate (HttpRequestMessage request)
        {
            var connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["EarthwatchersConnection"].ConnectionString;
            var result=Authenticator.Authenticate(connectionstring);
            return result;
        }
    }
}